package com.example.dagger3;

import com.example.dagger3.object.A;
import com.example.dagger3.object.B;
import com.example.dagger3.object.ObjectForMainModule;
import com.example.dagger3.object.User;

import javax.inject.Named;

import dagger.Module;
import dagger.Provides;

@Module
public class MainModule {

    @Provides
    public ObjectForMainModule providerObjectMainModule(){

        return new ObjectForMainModule();
    }

    @Provides
    public B providerB(){
        return new B();
    }
    @Provides
    public A providerA(B b){
        return new A(b);
    }

    @Named("key1")
    @Provides
    public User providerUser(){

        return new User("Li","123");
    }

    @Named("key2")
    @Provides
    public User providerUser2(){

        return new User("LiDe","456");
    }

}
